{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# [ Chapter 11 - Automating Learning to Rank with Click Models ]\n",
    "# Indexing Search Sessions Data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**NOTE**: This notebook depends upon the the Retrotech dataset. If you have any issues, please rerun the [Setting up the Retrotech Dataset](../ch04/1.setting-up-the-retrotech-dataset.ipyn) notebook or execute the next cell uncommented."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "sys.path.append(\"..\")\n",
    "from ltr import download"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Download simulated raw clickstream data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Already up to date.\n"
     ]
    }
   ],
   "source": [
    "![ ! -d 'retrotech' ] && git clone --depth 1 https://github.com/ai-powered-search/retrotech.git\n",
    "! cd retrotech && git pull\n",
    "! cp retrotech/sessions/* data/"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Already up to date.\n",
      "products.csv\n",
      "signals.csv\n",
      "\"upc\",\"name\",\"manufacturer\",\"short_description\",\"long_description\"\n",
      "\"096009010836\",\"Fists of Bruce Lee - Dolby - DVD\", , , \n",
      "\"043396061965\",\"The Professional - Widescreen Uncut - DVD\", , , \n",
      "\"085391862024\",\"Pokemon the Movie: 2000 - DVD\", , , \n",
      "\"067003016025\",\"Summerbreeze - CD\",\"Nettwerk\", , \n",
      "\"731454813822\",\"Back for the First Time [PA] - CD\",\"Def Jam South\", , \n",
      "\"024543008200\",\"Big Momma's House - Widescreen - DVD\", , , \n",
      "\"031398751823\",\"Kids - DVD\", , , \n",
      "\"037628413929\",\"20 Grandes Exitos - CD\",\"Sony Discos Inc.\", , \n",
      "\"060768972223\",\"Power Of Trinity (Box) - CD\",\"Sanctuary Records\", , \n",
      "Wiping \"products\" collection\n",
      "Creating \"products\" collection\n",
      "Status: Success\n",
      "Loading Products\n",
      "Schema: \n",
      "root\n",
      " |-- upc: long (nullable = true)\n",
      " |-- name: string (nullable = true)\n",
      " |-- manufacturer: string (nullable = true)\n",
      " |-- short_description: string (nullable = true)\n",
      " |-- long_description: string (nullable = true)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "#%run chapters/ch04/1.setting-up-the-retrotech-dataset.ipynb"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Up next: [Your First Click Model: Click Thru Rate](1.click-through-rate-judgments.ipynb)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
